package cc.tuhaolicai.mt.user.mobile.service;

import cc.tuhaolicai.mt.user.mobile.business.handler.BusinessHandler;
import cc.tuhaolicai.mt.user.mobile.model.Chain1Model;
import cc.tuhaolicai.mt.user.mobile.tool.ToolGen;
import cc.tuhaolicai.mt.user.mobile.tool.ToolMongo;

import java.util.Map;

/**
 * 业务1
 * @author chenli
 * @create 2017-10-12
 */
public class ChainHandler3 extends BusinessHandler {

    @Override
    public void execute( Map<String,Object> params) {
        String start = String.valueOf(params.get("start"));
        Integer startNum = Integer.parseInt(start);
        Chain1Model oldChain = (Chain1Model)params.get("chainModel");
        Chain1Model chain1Model = new Chain1Model();
        chain1Model.setStartName(oldChain.getEndName());
        chain1Model.setStartName("我是"+(startNum+1));
        chain1Model.setId(ToolGen.genId(Chain1Model.class,"id"));
        ToolMongo.insertOne(chain1Model);
        params.put("chainModel",chain1Model);
        addParams("start",startNum+1);
    }
}